Content starts here Validate, Build, Export, and Package Dataspace Projects from the Command Line
This page last changed on Feb 26, 2008.

eDocs Home > BEA AquaLogic Data Services Platform Documentation > Data Services Developer's Guide > Contents

How To Validate, Build, Export, and Package Dataspace Projects from the Command Line

This section describes how to validate, build, export and package ALDSP dataspace projects from the command line. 

Topics

Data Service File Validation During Deployment

In the Eclipse IDE a dataspace project's data service (.ds) files are validated automatically according to the following deployment model:

  • When a user wants to deploy a dataspace project to a WebLogic server using the Deploy Project option, all the Java projects referenced by the dataspace project are built.
  • The output files are packaged in JAR files (one per referenced Java project) in the dataspace project's DSP-INF/lib directory during deployment.
  • The deploy action validates the dataspace project.
  • All the project's artifacts are collected.
  • The collected artifacts are deployed to the server.

The ALDSP Export mechanism allows for a dataspace project's artifacts to be packaged in a JAR the contents of which are identical to what would be generated from the IDE for deployment to a WebLogic server.

Dataspace Packaging from the Command-line 

There is also an occasional need for operations such as validate, build, export, and package to be available in a scripting environment. This section describes an Ant script file, cmdline_build.xml, provided in the "bin" directory under the ALDSP installation that can be invoked by a user to:

  • Validate a dataspace project
  • Generate a deployment JAR file of a dataspace project
    For those not wishing or able to use Ant, Java equivalent command-line options are also described.

Syntax Summary

Command Syntax
help help [ {cmd} | dsp30:all ]
validate-project validate-project {project}
export-mediator-client export-mediator-client {project} {jardir} [jarname[dsp30:.jar]]
export-ws-client export-ws-client {project} {jardir} [jarname[dsp30:.jar]]  [dsp30:ws_locator,...]
export-artifacts export-artifacts {project} {jardir} [jarname[dsp30:.jar]]

Command-Line Ant Build Targets

This section describes available ALDSP ant build targets.

Build XML File 

The build XML file:

cmdline_build.xml

will be provided in the directory:

<dsp_home>/bin

To see a list of build targets with short descriptions in the Ant build XML file, invoke the command below at the prompt window:

ant -f <bea_home>/aldsp_3.0/bin/cmdline_build.xml -projecthelp






Notes
  • It is assumed that Ant is available on your computer and is on your path.  Some targets require:
    • ECLIPSE_HOME environment variable points to the Eclipse installation directory.
    • javac be available on the PATH variable.
  • Commands other than "help" involving an Eclipse project requires specification of the Eclipse workspace directory that contains the project. 
    • For Java commands the directory is specified via the "-data" option. 
    • For Ant command, it is specified as the "-Dworkspace" property.

"help"

The "help" target is the default build target.  It shows a list of available ALDSP commands and the syntax needed to invoke the command in Java.

Command Syntax
help help [ {cmd} | dsp30:"all"]

Build Invocation Syntax via Java

Note that the syntax shows the portion starting with "aldsp_command" below. However, the full syntax to be entered for Java at the prompt window is:

java -cp <eclipse_home_dir>/startup.jar org.eclipse.core.launcher.Main -data <workspace_dir> -application com.bea.dsp.ide.app.runCmdline <aldsp_command> <cmd_param> ...

Build Invocation Syntax via Ant

If invoked via Ant, ALDSP command parameters should be specified as Ant properties.  For example, to get help about the "export-artifacts" command, enter:

ant -f <aldsp_install_dir>/bin/cmdline_build.xml help -Dcmd=export-artifacts

To get help on all ALDSP commands, specify the following property:

-Dcmd=all

or omit the optional -Dcmd property completely:

ant -f <aldsp_install_dir>/bin/cmdline_build.xml help all

"validate-project"

The "validate-project" target validates the data service (.ds) files in the specified dataspace project.  Data service error messages that would show up in the Eclipse IDE's Problems view are sent to stdout when this target is invoked.  A "fail" status is returned by this target if any error exists in a .ds data service file in the project.

ant -f <aldsp_install_dir>/bin/cmdline_build.xml -Dworkspace=/bea/projects/myworkspace   -Dproject=MyFirstDspProject validate-project

Command
Syntax
validate-project
validate-project {project}

"export-mediator-client"

The export-mediator-client target is for generating an ALDSP mediator client JAR file of a dataspace project. 

The default value of the output JAR file name is:

<project>-dsp-client.jar

Command
Syntax
export-mediator-client export-mediator-client {project} {jardir} [dsp30:jarname.jar]

"export-ws-client"

The export-ws-client target generates a web services mediator client JAR file from the specified comma-separated list of wsmap file locators in a dataspace project. 

The default value of the output JAR filename is:

<project>-ws-client.jar

The default value of the ws_locators is all wsmap file locators in the project.

An example of a wsmap file locator is:

ld:logical/wsmaps/CUSTOMER.ws
Command
Syntax
export-ws-client export-ws-client {project} {jardir} [jarname[dsp30:.jar]]  [dsp30:ws_locator,...]

"export-artifacts"

The "export-artifacts" target creates a JAR file containing the definitions and artifacts of the dataspace project. The content would be identical to the artifact JAR file created in the IDE.  By default , the name of the artifact JAR file is:

<project>-artifacts.jar

Command
Syntax
export-artifacts
export-artifacts {project} {jardir} [jarname[dsp30:.jar]]
Notes
Referenced Java Projects

Since a dataspace project may reference other Java projects in the same Eclipse workspace, you should make certain that:

  • Referenced projects in your build script are also built.
  • The resulting JAR files and dependent JAR files are copied to the dataspace project's DSP-INF/lib directory. 

This needs to be done prior to exporting a deployable JAR file using the export-artifacts command in order for all referenced/required JAR files to be included in the artifact JAR file.

Invoking Build Commands Without Ant

The Ant targets described in the previous sections are actually implemented in Java.  So the actual implementation can be invoked at the prompt window using Java directly -- or any script process -- instead of Ant.

Command-line Examples using Ant and Java

This section contains several examples of invoking the ALDSP command using Ant and Java.

Getting the help text of all the commands using Ant and Java at the prompt window

Ant:

ant -f <bea_home>\aldsp_3.0\bin\cmdline_build.xml help -Dcmd=all

Java:

java -cp <eclipse_home>/eclipse/startup.jar org.eclipse.core.launcher.Main -application com.bea.dsp.ide.app.runCmdline help all

Getting the help text of a specific command using Ant and Java at the prompt window

Ant:

ant -f <bea_home>\aldsp_3.0\bin\cmdline_build.xml help -Dcmd=export-artifacts

Java:

java -cp <eclipse_home>/startup.jar org.eclipse.core.launcher.Main -application com.bea.dsp.ide.app.runCmdline help export-artifacts

Exporting the artifacts of a dataspace project

This example exports the project: 

DspProj

in workspace:

/MyWorkspace

to:

/temp

directory using the default JAR file name:

<project>-artifacts.jar

Ant:

ant -f <bea_home>\aldsp_3.0\bin\cmdline_build.xml -Dworkspace=/MyWorkspace -Dproject=DspProj -Djardir=/temp export-artifacts

Java:

java -cp <eclipse_home>/startup.jar org.eclipse.core.launcher.Main -data /MyWorkspace -application com.bea.dsp.ide.app.runCmdline export-artifacts DspProj /temp

Document generated by Confluence on Apr 28, 2008 15:54